<%--
  Created by IntelliJ IDEA.
  User: 余先生
  Date: 2021/6/8
  Time: 10:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="../js/jquery-3.4.1.min.js" language="JavaScript"></script>
    <script language="JavaScript">
        $(function () {
            $("#but1").click(function () {
                $.get("/getDate",null,function (data) {
                    console.log(data)
                    var table='<table border=2><tr><td>学号</td><td>姓名</td><td>年龄</td><td>性别</td></tr>';
                    for(var i=0;i<data.length;i++){
                        var obj=data[i];
                        table=table+'<tr><td>'+obj.xh+'</td><td>'+obj.name+'</td><td>'+obj.age+'</td><td>'+obj.sex+'</td></tr>';
                    }
                    table=table+"</table>";
                    $("#show").html(table);
                },"json");
            })
        })
    </script>
</head>
<body>
<input type="button" id="but1" value="点击查看">
<div id="show" ></div>
</body>
</html>
